﻿using System;

namespace Gonte.UI
{
    /// <summary>
    /// Describes the children to be used by the view model
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct,
        Inherited = false,
        AllowMultiple = true)]
    public class UserInterfaceItemAttribute
        : Attribute
    {
        #region Properties

        /// <summary>
        /// The name of the property of the object to retrieve the children from
        /// </summary>
        public string PropertyName
        {
            get { return _propertyName; }
            set { _propertyName = value; }
        }

        /// <summary>
        /// The name to display on the item node (folder) 
        /// </summary>
        public string DisplayName
        {
            get 
            {
                if (string.IsNullOrEmpty(_displayName))
                {
                    _displayName = _propertyName;
                }

                return _displayName; 
            }
            set { _displayName = value; }
        }

        #endregion

        #region Fields

        private string _propertyName;
        private string _displayName;
        private string _displayNameKey; // For localization

        #endregion
    }
}
